<template>
  <div class="data-sync-container">
    <!-- This component serves as a router view container for nested routes -->
    <router-view v-slot="{ Component }">
      <transition name="fade-transform" mode="out-in">
        <keep-alive :include="cachedViews">
          <component :is="Component" />
        </keep-alive>
      </transition>
    </router-view>
  </div>
</template>

<script setup lang="ts">
import { ref } from 'vue';

// 缓存视图列表 - 可以根据需要动态添加需要缓存的组件名
const cachedViews = ref<string[]>([
  'DataSyncTask',
  'DBConfig',
  'ExecutionLog'
]);
</script>

<style lang="scss" scoped>
.data-sync-container {
  width: 100%;
  height: 100%;
}

/* 页面切换过渡效果 */
.fade-transform-enter-active,
.fade-transform-leave-active {
  transition: all 0.3s;
}

.fade-transform-enter-from {
  opacity: 0;
  transform: translateX(30px);
}

.fade-transform-leave-to {
  opacity: 0;
  transform: translateX(-30px);
}
</style>